package com.luokangtao.common.annotation;

import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * resultfu风格
 *patch请求
 * @author luokangtao
 * @create 2019-07-26 11:43
 */
@RequestMapping(
        method = {RequestMethod.PATCH}
)
@Auth
@Target({ElementType.METHOD})//方法级注解
@Retention(RetentionPolicy.RUNTIME)//标记注解的储存方式(不然的话获取不到注解的值)
public @interface PatchApi {
    @AliasFor(
            annotation = Auth.class,
            attribute = "value"
    )
    boolean auth() default true;

    @AliasFor(
            annotation = Auth.class,
            attribute = "name"
    )
    String authName() default "";

    @AliasFor(
            annotation = Auth.class,
            attribute = "permissions"
    )
    String[] permissions() default {};

    @AliasFor(
            annotation = Auth.class,
            attribute = "internal"
    )
    boolean internal() default false;

    @AliasFor(
            annotation = RequestMapping.class,
            attribute = "name"
    )
    String name() default "";

    @AliasFor(
            annotation = RequestMapping.class,
            attribute = "path"
    )
    String[] value() default {};

    @AliasFor(
            annotation = RequestMapping.class,
            attribute = "path"
    )
    String[] path() default {};

    @AliasFor(
            annotation = RequestMapping.class,
            attribute = "params"
    )
    String[] params() default {};

    @AliasFor(
            annotation = RequestMapping.class,
            attribute = "headers"
    )
    String[] headers() default {};

    @AliasFor(
            annotation = RequestMapping.class,
            attribute = "consumes"
    )
    String[] consumes() default {};

    @AliasFor(
            annotation = RequestMapping.class,
            attribute = "produces"
    )
    String[] produces() default {};
}
